package com.project.class8_15.dao.impl;

import com.project.class8_15.bean.EmployeeBean;
import com.project.class8_15.dao.IEmployeeDao;

import java.util.List;

public class EmployeeDaoImpl extends BaseDao implements IEmployeeDao {
    @Override
    public void add(EmployeeBean em) {
        this.updateData("insert into t_employee(e_name,e_birthday,e_phone) values(?,?,?)",
                em.getE_name(),em.getE_birthday(),em.getE_phone());
    }

    @Override
    public void del(Integer id) {
        this.updateData("delete from t_employee where pk_employeeId=?",id);
    }

    @Override
    public void update(Integer id, String phone) {
        this.updateData("update t_employee set e_phone=? where pk_employeeId=?",phone,id);
    }

    @Override
    public List<EmployeeBean> findAll() {
        return this.find("select e_name,e_phone from t_employee",EmployeeBean.class);
    }

    @Override
    public List<EmployeeBean> findByName(String name) {
        return null;
    }
}
